package com.gitee.cui.springcloud.account.controller;

import java.math.BigDecimal;

import javax.annotation.Resource;

import com.gitee.cui.springcloud.account.domain.CommonResult;
import com.gitee.cui.springcloud.account.service.AccountService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO
 *
 * @author cuiqingqiang
 * @version 1.0
 * @date 2022-03-26 16:09
 **/
@RestController
@RequestMapping("/account")
public class AccountController {

	@Resource
	private AccountService accountService;

	@PostMapping("/decrease")
	public CommonResult decrease(@RequestParam("userId") Long userId, @RequestParam("money") BigDecimal money) {
		accountService.decrease(userId, money);
		return new CommonResult(200, "扣账户余额成功，扣除余额：" + money.toString());
	}
}
